﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MasterRoles_old.aspx.cs" Inherits="GPSTrackingWebsiteManager.Manager.Pages.MasterRoles_old" %>
<%@ Register Src="~/Manager/UserControls/MenuItemsSearch.ascx" TagPrefix="uc1" TagName="MenuItemsSearch" %>

<!DOCTYPE html>

<link href="../../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<link href="../../Css/messi.css" rel="stylesheet" />
<script src="../../Javascript/jquery-1.9.1.min.js"></script>
<script src="../../Javascript/messi.js"></script>
<script src="../../Javascript/Custom.js"></script>
<script src="../../Javascript/WindowMessageManager.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Roles de Master</title>
    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
    <script type="text/javascript">
        function resizeGrid() {
            var height = (window.innerHeight) - 25;
            var tableView = $find("<%=MasterRolesGrid.ClientID %>");
            tableView.get_element().style.height = (height) / 2 + "px";

            var tableView2 = $find("<%=MenuItemsGrid.ClientID %>");
            tableView2.get_element().style.height = (height - (height) / 2) + "px";

            document.getElementById('HiddenFieldHeight').value = (height);
        }

        //Windows Message Manager 
        var objWindowsMessageManager = new WindowsMessageManager();
    </script>
</telerik:RadScriptBlock>

</head>
<body onresize="resizeGrid()" style="overflow: hidden">
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="MasterRolesGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rmpMasterRoles" LoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" /> 
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="MenuItemsGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="MenuItemsGrid" LoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" /> 
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" ></telerik:RadAjaxLoadingPanel>

        <asp:HiddenField ID="HiddenFieldHeight" runat="server" Value="323" />
        <asp:HiddenField ID="HiddenFieldError" runat="server" Value="" />
        
        <telerik:RadTabStrip ID="rtsMasterRoles" runat="server" SelectedIndex="0" MultiPageID="rmpMasterRoles" ></telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpMasterRoles" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="rpvMasterRoles" runat="server">

        <div>

                <telerik:RadGrid ID="MasterRolesGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" OnDeleteCommand="MasterRolesGrid_DeleteCommand" OnInsertCommand="MasterRolesGrid_InsertCommand" OnNeedDataSource="MasterRolesGrid_NeedDataSource" OnUpdateCommand="MasterRolesGrid_UpdateCommand" OnSelectedIndexChanged="MasterRolesGrid_SelectedIndexChanged" AllowSorting="true" GroupingSettings-CaseSensitive="false" OnItemCommand="MasterRolesGrid_ItemCommand">
                    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                        </Scrolling>  <Selecting AllowRowSelect="True"></Selecting><ClientEvents OnPopUpShowing="PopUpShowing" />
                    </ClientSettings>

                    <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                    <CommandItemTemplate>
                        <div style="padding: 5px 5px;"> Roles de Master: 
                                <asp:LinkButton ID="lbAdd" runat="server" CommandName="InitInsert" Visible='<%# !MasterRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Nuevo Rol de Master</asp:LinkButton>
                                <asp:LinkButton ID="lbClearMasterRolesFilters" runat="server" OnClick="lbClearMasterRolesFilters_Click"  Visible='<%# !MasterRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>                                                                               
				                <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error Técnico</asp:LinkButton>                                                                                                               
                        </div>                        
                    </CommandItemTemplate>

                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>

                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>

                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="25px" EditText="Editar" ItemStyle-Width="20px"/>
                            <telerik:GridButtonColumn HeaderStyle-Width="25px" ConfirmText="¿Desea eliminar el registro?" ConfirmDialogType="RadWindow" ConfirmDialogHeight="120" ConfirmDialogWidth="270" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" Text="Eliminar" ItemStyle-Width="20px" />
                            <telerik:GridBoundColumn DataField="MasterRoleId" FilterControlAltText="Filter GPSModelID column" HeaderText="Role ID" UniqueName="MasterRoleId" ItemStyle-Width="100px" Display="false" ReadOnly="true" ForceExtractValue="Always">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText=" Role" UniqueName="Name"   HeaderStyle-Width="200px" MaxLength="50" FilterControlWidth="180px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                                 <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>                            
                        </Columns>

                        <EditFormSettings>
                            <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                      <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                        </Scrolling>
                    </ClientSettings>
                    <FilterMenu EnableImageSprites="False"></FilterMenu>
                </telerik:RadGrid>
            <br/>
                            <telerik:RadGrid ID="MenuItemsGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" Width="100%" OnDeleteCommand="MenuItemsGrid_DeleteCommand" OnNeedDataSource="MenuItemsGrid_NeedDataSource" AllowSorting="true" GroupingSettings-CaseSensitive="false">
                        <ClientSettings EnableRowHoverStyle="true">
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                            </Scrolling>  <Selecting AllowRowSelect="True"></Selecting><ClientEvents OnPopUpShowing="PopUpShowing" />
                        </ClientSettings>
                        <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                        <CommandItemTemplate>
                            <div style="padding: 5px 5px;"> Pantallas: 
                                    <asp:LinkButton ID="lbAddPage" runat="server" OnClientClick="OpenMenuItemsSearch()"><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Asociar Pantalla</asp:LinkButton>     
                                    <asp:LinkButton ID="lbClearMenuItemsFilters" runat="server" OnClick="lbClearMenuItemsFilters_Click"  Visible='<%# !MenuItemsGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>                                                                               
				                    <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error Técnico</asp:LinkButton>                                                                                                               
                            </div>                        
                        </CommandItemTemplate>

                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>

                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>

                        <Columns>
                            <telerik:GridButtonColumn HeaderStyle-Width="25px" ConfirmText="¿Desea eliminar el registro?" ConfirmDialogType="RadWindow" ConfirmDialogHeight="120" ConfirmDialogWidth="270" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" Text="Eliminar" ItemStyle-Width="20px" />
                            <telerik:GridBoundColumn DataField="ItemID" Display="false" FilterControlAltText="Filter MasterUsername column" HeaderText="ItemID" UniqueName="ItemID" ForceExtractValue="Always" ReadOnly="true" HeaderStyle-Width="200px" MaxLength="50" FilterControlWidth="180px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Password column" HeaderText="Descripción Pantalla" UniqueName="Description" HeaderStyle-Width="200px" MaxLength="50" FilterControlWidth="180px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Value" FilterControlAltText="Filter Password column" HeaderText="Opción Menu Pantalla" UniqueName="Value" HeaderStyle-Width="200px" MaxLength="50" FilterControlWidth="180px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ValueOwner" HeaderText="Menu" UniqueName="ValueOwner" ForceExtractValue="Always" HeaderStyle-Width="200px" MaxLength="50" FilterControlWidth="180px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true" >
                            </telerik:GridBoundColumn>
                        </Columns>

                        <EditFormSettings>
                            <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                        </EditFormSettings>

                        <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                    </MasterTableView>

                    <FilterMenu EnableImageSprites="False"></FilterMenu>
                </telerik:RadGrid>
        </div>
        </telerik:RadPageView>
        </telerik:RadMultiPage>
        <uc1:MenuItemsSearch ID="MenuItemsSearch" runat="server" IsMultipleSelects="true" CalledBy="MasterRoles" IsClearGridAfterClose="true" OnOnAcceptEvent="uscMenuItemsSearch_OnAcceptEvent" OnOnCancelEvent="uscMenuItemsSearch_OnCancelEvent"/>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>   
    </form>
</body>
</html>
